package com.bbx.api.util;

import java.io.UnsupportedEncodingException;

/**
 * 字符串转换格式
 */
public class ChangeCharset {
	  public static String GBK="GBK";
	  public static String UTF_8="utf-8";
	  public static final String US_ASCII = "US-ASCII";
	  public static String changeCharset(String str, String newCharset) throws UnsupportedEncodingException {
	        if(str != null) {
	            //用默认字符编码解码字符串。与系统相关，中文windows默认为GB2312
	            byte[] bs = str.getBytes();
	            return new String(bs, newCharset);    //用新的字符编码生成字符串
	        }
	        return null;
	    }
}
